package framework.dubbo.demo.provider;

import java.io.IOException;

import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * DUBBO 服务端
 *
 * @author ME
 * @date   2020/2/24
 */
public class DubboProvider {

    public static void main( String[] args ) throws IOException {
        // 加载xml配置文件启动
        // ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("framework/dubbo/demo/provider/provider.xml");
        // context.start();

        // 注解配置
        AnnotationConfigApplicationContext context1 = new AnnotationConfigApplicationContext();
        context1.register(DubboConfig.class);
        context1.refresh();
        System.in.read(); // 按任意键退出
    }

    @Configuration
    @EnableDubbo(scanBasePackages = "spring.DI")
    @PropertySource("classpath:/framework/dubbo/demo/provider/provider.properties")
    public static class DubboConfig {
    }

}
